//
//  CompanyAboutViewController.m
//  AnXin100
//
//  Created by Sakura on 2018/11/10.
//  Copyright © 2018 tzhg. All rights reserved.
//

#import "CompanyAboutViewController.h"
#import "CompanyAboutTableViewCell.h"
@interface CompanyAboutViewController ()<UITableViewDelegate, UITableViewDataSource>

@property (nonatomic, strong) UITableView *mainTable;

@end

@implementation CompanyAboutViewController


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:self.mainTable];
    
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0)];
    headView.backgroundColor = [UIColor whiteColor];
    
    UIImageView *imageHeadView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH - 20, 120)];
    imageHeadView.image = [UIImage imageNamed:@"companyAboutHead"];
    [headView addSubview:imageHeadView];
    
    UILabel *companyAboutLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 120, SCREEN_WIDTH, 0)];
    companyAboutLabel.text = @"是集有机食品、功能性食品和民族药研发、种植、加工、生产、销售为一体，持续坚持与高原特色生物资源紧密结合，以市场为导向，以科技创新为核心竞争力，以品牌打造为发展战略，以标准精细管理为引领，以专业人才为支撑，以先进生产设备为保障，以基础建设为基础，满足广大消费者对天然保健产品的需求，致力于打造有机、健康养生产品品牌，做强做大、做深做透开发资源型特色农业产业，把大农业产业做成大健康产业。";
    companyAboutLabel.textColor = [UIColor colorWithHex:0x333333];
    companyAboutLabel.font = [UIFont systemFontOfSize:14];
    companyAboutLabel.numberOfLines = 0;
    companyAboutLabel.mj_h = [companyAboutLabel.text textSizeWithFont:[UIFont systemFontOfSize:14] numberOfLines:0 constrainedWidth:SCREEN_WIDTH - 20].height;
    [headView addSubview:companyAboutLabel];
    
    UILabel *titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(companyAboutLabel.frame) + 10, SCREEN_WIDTH - 20, 30)];
    titleLabel.font = [UIFont systemFontOfSize:16];
    titleLabel.textColor = [UIColor colorWithHex:0x29B566];
    titleLabel.text = @"相关产品";
    [headView addSubview:titleLabel];
    
    headView.mj_h = CGRectGetMaxY(titleLabel.frame) +  10;
    _mainTable.tableHeaderView = headView;
    
    UIButton *commitBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    commitBtn.frame = CGRectMake(0, SCREEN_HEIGHT - 40, SCREEN_WIDTH, 40);
    commitBtn.backgroundColor = COLOR_ORG;
    [commitBtn setTitle:@"进入店铺" forState:UIControlStateNormal];
    [self.view addSubview:commitBtn];
}

- (UITableView *)mainTable {
    if (!_mainTable) {
        _mainTable = [[UITableView alloc] initWithFrame:CGRectMake(0, Hn, SCREEN_WIDTH, SCREEN_HEIGHT - Hn - 40) style:UITableViewStylePlain];
        _mainTable.delegate = self;
        _mainTable.dataSource = self;
        [_mainTable registerNib:[UINib nibWithNibName:@"CompanyAboutTableViewCell" bundle:nil] forCellReuseIdentifier:@"CompanyAboutTableViewCell"];

    }
    return _mainTable;
}

#pragma mark - UITableView Delegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 95;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    CompanyAboutTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CompanyAboutTableViewCell"];
    return cell;
}


@end
